home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / MATHS / ARCAUT / Automatons / BBM < prev    next >
Text File  |  1991-07-26  |  2KB  |  68 lines

  1. AUTOMATON*
  2.  
  3.   BBM
  4.  
  5.   This provides the basic components for a ballistic computer. Information
  6.   is passed by 'billiard balls' bouncing around off each other & 'mirrors'.
  7.   It is a two state automaton; both balls & mirrors are composite objects.
  8.   The current code simply scatters balls & mirrors randomly in the window to
  9.   demonstrate the automaton. Unlike the logical operator OR, fundamental to
  10.   actual computers, all the processes in BBM are reversible (alter 'phase' in
  11.   menu to see this); the Margolus neighbourhood was originally devised to
  12.   implement such a device. Whether this could be done was a particularly
  13.   interesting question because the actual physical laws governing all matter
  14.   (as currently understood) are reversible, unlike most of the processes that
  15.   we observe (like the operation of this computer, or the breaking of a
  16.   glass); this dichotomy is explained by the second law of thermodynamics! -
  17.   there are far more states that we perceive as disordered than ordered, thus
  18.   the chance of a reversible process taking an arbitrary disordered state to
  19.   an ordered one is small. You can demonstrate this for yourself; take one
  20.   political party, place in the position of government for twelve years &
  21.   watch what happens to the economy, employment levels, national health
  22.   service & so on.
  23.  
  24. INITIALISATION*
  25.  
  26.   10DEF PROCdo
  27.   20*SetEval wrap off
  28.   30*SetEval border 255
  29.   40*SetEval neig margolus
  30.   50ENDPROC
  31.  
  32. SCREEN*
  33.  
  34.   10DEF PROCdo
  35.   20DIM buf% 256:SYS "OS_ReadVarVal","sux",buf%,256:sx%=!buf%
  36.   30SYS "OS_ReadVarVal","suy",buf%,256:sy%=!buf%
  37.   40GCOL 63 TINT 255
  38.   50FOR Q%=1 TO 20*sx%*sy%/(128*128)
  39.   60PROCmirror(RND(sx%/2)-sx%/4,RND(sy%/2)-sy%/4,RND(32),RND(2)-1)
  40.   70NEXT
  41.   80FOR Q%=1 TO 10*sx%*sy%/(128*128)
  42.   90PROCball(RND(sx%/2)-sx%/4,RND(sy%/2)-sy%/4,RND(4)-1)
  43.  100NEXT
  44.  110ENDPROC
  45.  120DEF PROCmirror(x,y,l,f)
  46.  130IF f THEN
  47.  140RECTANGLE FILL 8*x+4,8*y,8*l-1,7
  48.  150ELSE
  49.  160RECTANGLE FILL 8*x+4,8*y,7,8*l-1
  50.  170ENDIF
  51.  180ENDPROC
  52.  190DEF PROCball(x,y,f)
  53.  200CASE f OF
  54.  210WHEN 0:POINT 8*x,8*y:POINT 8*x+8,8*y+8
  55.  220WHEN 1:POINT 8*x-4,8*y-4:POINT 8*x+4,8*y+4
  56.  230WHEN 2:POINT 8*x+4,8*y:POINT 8*x-4,8*y+8
  57.  240WHEN 3:POINT 8*x,8*y+4:POINT 8*x+8,8*y-4
  58.  250ENDCASE
  59.  260ENDPROC
  60.  
  61. CODE*
  62.  
  63. ( READ_NEIG
  64.   255 SCOUNT_ALL DUP 1 = IF (OPP ==)
  65.                      2 = IF (CELL OPP = IF (CW ==) CELL ==)
  66.                              CELL == )
  67.  
  68. END*